package com.luyuan.controller;

import com.luyuan.common.util.ResponseUtils;
import com.luyuan.dao.dto.Url;
import com.luyuan.dao.dto.User;
import com.luyuan.service.UrlService;
import com.luyuan.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: lailuyuan
 * @date: 2025-01-22 10:11
 * @desc:
 */
@Api(tags = "资源url接口")
@RestController
@RequestMapping("/urls")
public class UrlController {

   @Autowired
   private UrlService urlService;

   @GetMapping("/list")
   public ResponseUtils getAllUrls() {
      return ResponseUtils.success(urlService.getAllUrls());
   }

   @PostMapping("/add")
   public ResponseUtils createUrl(@RequestBody Url url) {
      urlService.saveUrl(url);
      return ResponseUtils.success();
   }

}

